Repository navigation
⚡ Bolt: Wrap-Up discovery probes each title's first earlier play through the title indexes - #371
Merged
Merged
Conversation
…ugh the title indexes Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014GBDV9buG5jpG3Nj4AWBMs
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
wrapup_facts._discovery("Scout vs Loyalist") asks which of the period's top titles were played before the period. It usedSELECT DISTINCT coalesce(series_title, title) ... WHERE coalesce(...) IN (top titles): the same index-defeating shape #360 fixed in_comebacks, plus a DISTINCT over every earlier play of regular artists.Measured on a seeded DB (384k music plays, 20k film plays, ANALYZE, 3000 artists with Pareto-skewed play counts), median of 3: 0.60 s for week and 0.63 s for month (
allscope), 0.59 s for music week.Change
One
.first()probe per title (at most ~80), with the predicate spelledseries_title = k OR (series_title IS NULL AND title = k)so the title indexes serve it and each probe stops at the first hit. Same semantics: a title counts as known if any earlier play of the member exists (noa_playfilter, same as before).Measured effect / proof
The OR-only rewrite (a single IN query with DISTINCT) reached only 0.27 s, so probing is used. Outputs were identical in all four cases.
Tests
tests/test_wrapup_discovery_index.py: checks the film, series, artist and series_title-shadows-title cases, and pins the plan (index SEARCH, no SCAN) of the probe. Without the change it fails ("one first-hit probe per title"); with it, 4/4 pass.python tests/run_all.py: 357/358 green; the one failure is the known sandbox-onlytest_enrichment_status_perf.py(SQLite plan, fails identically on untouched main, passes in CI).Risk & edge cases
series_titlefalls back totitleas before; emptytitlesandperiod.key == "all"return early as before._comebacks), different function.Duplicate check
Searched my journal, the other personas' journals, PRs for "discovery"/"wrapup", and
git log -300: #360 and #368 touch_comebacksonly;_discoveryis untouched on main.Generated by Claude Code